<template>
    <s-layout title="任务信息上传">
      <view>
            <view class="form-item">
              <view class="area-box">
				  <view class="title ss-m-b-30">完成信息</view>
                <uni-easyinput
                  type="textarea"
                  maxlength="120"
                  autoHeight
                  v-model="state.model.content"
                  placeholder="请填写或上传任务完成信息"
                ></uni-easyinput>
  
                <view class="img-box">
				<view class="title ss-m-b-30">完成截图</view>
                  <s-uploader
                    v-model:url="state.model.images"
                    fileMediatype="image"
                    limit="9"
                    mode="grid"
                    :imageStyles="{ width: '168rpx', height: '168rpx' }"
                  />
                </view>
              </view>
            </view>
      </view>

<!--      <view v-else>
            <view class="form-item">
            <view class="area-box">
                <uni-easyinput
                type="textarea"
                maxlength="120"
                autoHeight
                disabled
                v-model="state.List.content"></uni-easyinput>

                <view class="img-box">
                <s-uploader
                    v-model:url="state.imglist"
                    fileMediatype="image"
                    limit="9"
                    mode="grid"
                    :imageStyles="{ width: '168rpx', height: '168rpx' }"/>
                </view>
            </view>
            </view>
    </view> -->
  
      <su-fixed bottom placeholder v-if="state.List.status != '待审核'">
        <view class="foot_box ss-flex ss-row-center ss-col-center">
          <!-- <button class="ss-reset-button post-btn ui-BG-Main-Gradient ui-Shadow-Main" @tap="onSubmit">
            提交
          </button> -->
          <button type="primary"  style="width: 90%;margin-bottom:20px" @click="onSubmit()">提交</button>
        </view>
      </su-fixed>
    </s-layout>
  </template>
  
  <script setup>
    import { ref } from 'vue'
    import sheep from '@/sheep';
    import { onLoad } from '@dcloudio/uni-app';
    import { computed, reactive } from 'vue';
  
    const state = reactive({
        model:{},
        List:{},
        imglist:{}
    });
  
    const apiUrl = ref(import.meta.env.SHOPRO_BASE_URL)
  
    async function onSubmit() {
        console.log(state.model)
        const res = await sheep.$api.task.createOrderaddAata(state.model)
        if(res.code == 1){
            sheep.$helper.toast(res.msg);
            sheep.$router.go('/pages/task/taskorder');
        }    
        console.log(res)
        //   if (code === 1) {
    //     sheep.$router.back();
    //   }
    }
  
    onLoad(async (options) => {
      let id = '';
      console.log(options)
      if (options.orderID) {
        id = options.orderID;
        state.model.id = id
      }
     


    });
  </script>
  
  <style lang="scss" scoped>
    // 评价商品
    .goods-card {
      margin: 10rpx 0;
      padding: 20rpx;
      background: #fff;
    }
  
    // 评论，选择图片
    .form-item {
      background: #fff;
      .star-box {
        height: 100rpx;
        padding: 0 25rpx;
      }
      .star-title {
        font-weight: 600;
      }
    }
    .area-box {
      width: 690rpx;
      min-height: 306rpx;
      background: rgba(249, 250, 251, 1);
      border-radius: 20rpx;
      padding: 28rpx;
      margin: auto;
  
      .img-box {
        margin-top: 20rpx;
      }
    }
    .post-btn {
      width: 690rpx;
      line-height: 80rpx;
      border-radius: 40rpx;
      color: rgba(#fff, 0.9);
      margin-bottom: 20rpx;
    }
  </style>
  